package cn.neusoft.yuejian307.Fragment.insidefragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import cn.neusoft.yuejian307.R;
import cn.neusoft.yuejian307.adapter.ActivityAdapter;
import cn.neusoft.yuejian307.bean.Choiceness;
import cn.neusoft.yuejian307.listener.UserListener;
import cn.neusoft.yuejian307.model.UserModel;



public class FragmentActivity extends Fragment implements UserListener<Choiceness>{
    private RecyclerView recyclerView_activity;
     View view;
    @Override
    public View onCreateView(LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState)
    {
        view = inflater.inflate(R.layout.fragment_activity,null) ;

        recyclerView_activity = (RecyclerView)view.findViewById(R.id.recyclerView_activity);
        recyclerView_activity.setLayoutManager(new LinearLayoutManager(getActivity()));
        UserModel userModel = new UserModel();
        userModel.activityData(this);
        return view ;
    }

    @Override
    public void onResponse(Choiceness choiceness) {
        List<Choiceness.ActivitydataBean> attentiondataBeen = choiceness.getActivitydata();
        ActivityAdapter adapter = new ActivityAdapter(getActivity(),attentiondataBeen);
        recyclerView_activity.setAdapter(adapter);
    }

    @Override
    public void onFail(String msg) {

    }
}
